package cn.hs.service.impl;

import cn.hs.entity.Publicity;
import cn.hs.entity.Systemuser;
import cn.hs.mapper.SystemuserMapper;
import cn.hs.service.SystemuserService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @ClassName SystemuserService
 * @Description TODO
 * @Author CnYuu
 * @Date 2024年10月22日 16:57
 * @Version 1.0
 */
@Service
public class SystemuserServiceImpl implements SystemuserService {
    @Autowired
    private SystemuserMapper systemuserMapper;
    @Override
    public Systemuser login(String username, String password) {
        Systemuser systemuser = systemuserMapper.selectByUsernameAndPassword(username, password);
        return systemuser;
    }

    @Override
    public PageInfo findAll(Integer pageNum, Integer pageSize, Systemuser systemuser) {
        PageHelper.startPage(pageNum,pageSize);
        List<Systemuser> systemusers=systemuserMapper.selectAll(systemuser);
        PageInfo<Systemuser> pageInfo=new PageInfo<>(systemusers);
        return pageInfo;
    }

    @Override
    public List<Systemuser> find(Systemuser systemuser) {
        return systemuserMapper.selectAll(systemuser);
    }

    @Override
    public int insert(Systemuser systemuser) {
        return systemuserMapper.insertAll(systemuser);
    }

    @Override
    public int update(Systemuser systemuser) {
        return systemuserMapper.updateSelective(systemuser);
    }

    @Override
    public int delete(Integer id) {
        return systemuserMapper.deleteById(id);
    }

  
}
